home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / expand.doc < prev    next >
Text File  |  1995-03-31  |  2KB  |  38 lines

  1. EXPAND.DOC by Joe Horn 
  2. All about the System RPL word 'EXPAND' 
  3.  
  4. EXPAND appends zeros onto a character string or hex string. 
  5.  
  6. The 'MKHXS' program on Goodies Disk #7 uses EXPAND.  Its DOC file 
  7. stated that it is unfortunate that HP's documentation fails to explain 
  8. the EXPAND command.  So, here's the explanation. 
  9.  
  10. INPUT: 
  11.  
  12. 2: String (either $ or HXS) 
  13. 1: System Binary (number of zeros you want to append to string) 
  14.  
  15. OUTPUT: 
  16.  
  17. 1: null-expanded String (padded with trailing nulls, on right end) 
  18.  
  19. NB: The System Binary refers to the number of zero NIBBLES you wish to 
  20. append; if you expand a string, use a number TWICE as large as the 
  21. number of null bytes you wish to append. 
  22.  
  23. EXAMPLES: "ABC"  # 8h  EXPAND  -->  "ABC...."  (4 nulls appended) 
  24.           "ABC"  # Ah  EXPAND  -->  "ABC....."  (5 nulls appended) 
  25.           NULLHXS  # 8h  EXPAND  -->  HXS 8 00000000 
  26.           HXS 3 123  # 4  EXPAND  -->  HXS 1230000 
  27.  
  28. IMPORTANT: Using EXPAND on character strings with an odd number in 
  29. stack level one creates character strings with odd nibble 
  30. lengths, which is not a normal situation.  The trailing "extra" nibble 
  31. will be invisible in the display, but is not lost during any normal 
  32. string operations.  Although this cannot cause any problems such as 
  33. corrupting memory, it can lead to unexpected results, such as two 
  34. strings that look identical not comparing as equal; or concatenating 
  35. strings and "nibble-shifting" the second one into garbage.  You can 
  36. also hide a value in this hidden nibble.  Just be careful that you 
  37. don't forget its presence. 
  38.